Optimal. Leaf size=271 \[ \frac{\sqrt{2} b c \left (\frac{b^2-2 a c}{b \sqrt{b^2-4 a c}}+1\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (b-\sqrt{b^2-4 a c}\right )+2 c}{\sqrt{2} \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a^2 \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}+\frac{\sqrt{2} b c \left (1-\frac{b^2-2 a c}{b \sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (\sqrt{b^2-4 a c}+b\right )+2 c}{\sqrt{2} \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a^2 \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}+\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\cot (x)}{a} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.895027, antiderivative size = 271, normalized size of antiderivative = 1., number of steps used = 12, number of rules used = 8, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.421, Rules used = {3256, 3770, 3767, 8, 3292, 2660, 618, 204} \[ \frac{\sqrt{2} b c \left (\frac{b^2-2 a c}{b \sqrt{b^2-4 a c}}+1\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (b-\sqrt{b^2-4 a c}\right )+2 c}{\sqrt{2} \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a^2 \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}+\frac{\sqrt{2} b c \left (1-\frac{b^2-2 a c}{b \sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (\sqrt{b^2-4 a c}+b\right )+2 c}{\sqrt{2} \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a^2 \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}+\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\cot (x)}{a} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3256
Rule 3770
Rule 3767
Rule 8
Rule 3292
Rule 2660
Rule 618
Rule 204
Rubi steps
\begin{align*} \int \frac{\csc ^2(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx &=\int \left (-\frac{b \csc (x)}{a^2}+\frac{\csc ^2(x)}{a}+\frac{b^2 \left (1-\frac{a c}{b^2}\right )+b c \sin (x)}{a^2 \left (a+b \sin (x)+c \sin ^2(x)\right )}\right ) \, dx\\ &=\frac{\int \frac{b^2 \left (1-\frac{a c}{b^2}\right )+b c \sin (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx}{a^2}+\frac{\int \csc ^2(x) \, dx}{a}-\frac{b \int \csc (x) \, dx}{a^2}\\ &=\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\operatorname{Subst}(\int 1 \, dx,x,\cot (x))}{a}+\frac{\left (c \left (b-\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \int \frac{1}{b+\sqrt{b^2-4 a c}+2 c \sin (x)} \, dx}{a^2}+\frac{\left (c \left (b+\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \int \frac{1}{b-\sqrt{b^2-4 a c}+2 c \sin (x)} \, dx}{a^2}\\ &=\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\cot (x)}{a}+\frac{\left (2 c \left (b-\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{b+\sqrt{b^2-4 a c}+4 c x+\left (b+\sqrt{b^2-4 a c}\right ) x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )}{a^2}+\frac{\left (2 c \left (b+\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{b-\sqrt{b^2-4 a c}+4 c x+\left (b-\sqrt{b^2-4 a c}\right ) x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )}{a^2}\\ &=\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\cot (x)}{a}-\frac{\left (4 c \left (b-\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{4 \left (4 c^2-\left (b+\sqrt{b^2-4 a c}\right )^2\right )-x^2} \, dx,x,4 c+2 \left (b+\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )\right )}{a^2}-\frac{\left (4 c \left (b+\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{-8 \left (b^2-2 c (a+c)-b \sqrt{b^2-4 a c}\right )-x^2} \, dx,x,4 c+2 \left (b-\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )\right )}{a^2}\\ &=\frac{\sqrt{2} c \left (b+\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{2 c+\left (b-\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )}{\sqrt{2} \sqrt{b^2-2 c (a+c)-b \sqrt{b^2-4 a c}}}\right )}{a^2 \sqrt{b^2-2 c (a+c)-b \sqrt{b^2-4 a c}}}+\frac{\sqrt{2} c \left (b-\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{2 c+\left (b+\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )}{\sqrt{2} \sqrt{b^2-2 c (a+c)+b \sqrt{b^2-4 a c}}}\right )}{a^2 \sqrt{b^2-2 c (a+c)+b \sqrt{b^2-4 a c}}}+\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\cot (x)}{a}\\ \end{align*}
Mathematica [C] time = 1.31576, size = 388, normalized size = 1.43 \[ \frac{\csc ^2(x) (-2 a-2 b \sin (x)+c \cos (2 x)-c) \left (-\frac{2 c \left (b \sqrt{4 a c-b^2}+2 i a c-i b^2\right ) \tan ^{-1}\left (\frac{2 c+\tan \left (\frac{x}{2}\right ) \left (b-i \sqrt{4 a c-b^2}\right )}{\sqrt{2} \sqrt{-i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}\right )}{\sqrt{2 a c-\frac{b^2}{2}} \sqrt{-i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}+\frac{2 i c \left (i b \sqrt{4 a c-b^2}+2 a c-b^2\right ) \tan ^{-1}\left (\frac{2 c+\tan \left (\frac{x}{2}\right ) \left (b+i \sqrt{4 a c-b^2}\right )}{\sqrt{2} \sqrt{i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}\right )}{\sqrt{2 a c-\frac{b^2}{2}} \sqrt{i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}-a \tan \left (\frac{x}{2}\right )+a \cot \left (\frac{x}{2}\right )+2 b \log \left (\sin \left (\frac{x}{2}\right )\right )-2 b \log \left (\cos \left (\frac{x}{2}\right )\right )\right )}{4 a^2 \left (a \csc ^2(x)+b \csc (x)+c\right )} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.187, size = 1087, normalized size = 4. \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\csc ^{2}{\left (x \right )}}{a + b \sin{\left (x \right )} + c \sin ^{2}{\left (x \right )}}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\csc \left (x\right )^{2}}{c \sin \left (x\right )^{2} + b \sin \left (x\right ) + a}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]